package flown.math;

public class Vector2
{
    public float x;
    public float y;

    public Vector2() { this(0, 0); }
    public Vector2(float x, float y)
    {
        this.x = x;
        this.y = y;
    }

    /**
     * 做加法
     * @param v1 vector1
     * @param v2 vector2
     * @return new vector
     */
    public static Vector2 Plus(Vector2 v1,Vector2 v2)
    {
        return new Vector2(v1.x + v2.x, v1.y + v2.y);
    }

    /**
     * 做减法
     * @param v1 vector1
     * @param ve ctor2
     * @return new vector
     */
    public static Vector2 Minus(Vector2 v1,Vector2 v2)
    {
        return new Vector2(v1.x - v2.x, v1.y - v2.y);
    }

    /**
     * 做乘法
     * @param v1 vector1
     * @param v2 vector2
     * @return new vector
     */
    public static Vector2 Time(Vector2 v1,Vector2 v2)
    {
        return new Vector2(v1.x * v2.x, v1.y * v2.y);
    }

    /**
     * 做除法
     * @param v1 vector1
     * @param v2 vector2
     * @return new vector
     */
    public static Vector2 Divided(Vector2 v1,Vector2 v2)
    {
        return new Vector2(v1.x / v2.x, v1.y / v2.y);
    }
}
